home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / progjour / 1991 / 06 / winclass.h < prev    next >
C/C++ Source or Header  |  1991-06-15  |  2KB  |  69 lines

  1. class WINDOW
  2. {
  3.   protected:
  4.     HWND hWnd;
  5.     int nCmdShow;
  6.     LPPAINTSTRUCT lpPaint;
  7.     WORD wParam;
  8.     LONG lParam;
  9.  
  10.     virtual void DefineCreate
  11.         ( CREATESTRUCT &CreateStruct );
  12.     virtual void DefineWClass ( WNDCLASS &WndClass );
  13.     virtual LPSTR GetClassName() {return "Generic";};
  14.     virtual LPSTR GetWindowName()
  15.         {return GetClassName();};
  16.     BOOL Show()
  17.         { return ShowWindow( hWnd, nCmdShow ); }
  18.     void Update() { UpdateWindow( hWnd ); }
  19.     virtual void CallPaint ();
  20.     int getx() { return LOWORD(lParam); };
  21.     int gety() { return HIWORD(lParam); };
  22.  
  23.     virtual void Create() {};
  24.     virtual void InitDialog() {};
  25.     virtual void Paint() {};
  26.     virtual long Command () {return TRUE;};
  27.     virtual void Timer () {};
  28.     virtual void Size () {};
  29.     virtual void MouseMove () {};
  30.     virtual void LButtonDown () {};
  31.     virtual void LButtonUp () {};
  32.     virtual void Destroy ();
  33.     virtual long DefaultProc(WORD iMessage)
  34.       {return DefWindowProc( hWnd, iMessage,
  35.                              wParam, lParam );};
  36.  
  37.   public:
  38.     WINDOW();
  39.     HWND GetHandle() { return hWnd; }
  40.     void PutHandle ( HWND hWndPrm ) { hWnd = hWndPrm; }
  41.     virtual BOOL Make ();
  42.     ~WINDOW() { if (hWnd) DestroyWindow (hWnd); };
  43.     long WndProc( WORD iMessage, WORD wParamPrm,
  44.                   LONG lParamPrm );
  45. };
  46. typedef WINDOW * PWINDOW;
  47.  
  48. class MAINWINDOW : public WINDOW
  49. {
  50.   void Destroy() { WINDOW::Destroy();
  51.                    PostQuitMessage( 0 ); };
  52. };
  53. typedef MAINWINDOW * PMAINWINDOW;
  54.  
  55. class DIALOG : public WINDOW
  56. {
  57.   public:
  58.     virtual LPSTR GetTemplateName()
  59.          {return "GenericDlg";};
  60.     int Make (HWND hParent);
  61.     long DefaultProc(WORD iMessage);
  62.     void Destroy();
  63. };
  64. typedef DIALOG * PDIALOG;
  65.  
  66. typedef BOOL (*BOOLPROC) ();
  67. void RegisterInstance ( BOOLPROC InitInstance );
  68. void RegisterApplication ( BOOLPROC InitApplication );
  69.